/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import main.WinkelApplication;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import javax.swing.JFrame;
import user.UserHandler;


/**
 *
 * @author Wouter
 */
public class MainMenu extends javax.swing.JPanel {

	/**
	 * Creates new form MainMenu
	 */
	public MainMenu() {
		initComponents();
	}
	
	public static final String IMG_ROOT = "C:\\Dropbox\\Project Outfit - Team 11\\";

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	 private void initComponents() {

		  jLabel3 = new javax.swing.JLabel();
		  jButton1 = new javax.swing.JButton();
		  jButton2 = new javax.swing.JButton();
		  jButton3 = new javax.swing.JButton();
		  jLabel2 = new javax.swing.JLabel();

		  setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

		  jLabel3.setIcon(new javax.swing.ImageIcon(IMG_ROOT + "teamlogo11.png")); // NOI18N
		  add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 30, -1, -1));

		  jButton1.setText("Klantbeheer");
		  jButton1.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent evt) {
					 jButton1ActionPerformed(evt);
				}
		  });
		  add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 180, 170, 80));

		  jButton2.setText("Catalogus");
		  jButton2.setBorderPainted(false);
		  jButton2.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent evt) {
					 jButton2ActionPerformed(evt);
				}
		  });
		  add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 180, 170, 80));

		  jButton3.setText("Voorraad beheer");
		  jButton3.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
					jButton3ActionPerformed(evt);
				}
		  });
		  add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 180, 170, 80));

		  jLabel2.setIcon(new javax.swing.ImageIcon(IMG_ROOT + "bg.png")); // NOI18N
		  jLabel2.setText("jLabel2");
		  add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
		
		jButton4 = new javax.swing.JButton();
		
		  jButton4.setText("De ben ik ingelogd knop?");
		  jButton4.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent evt) {
					 jButton4ActionPerformed(evt);
				}
		  });
		  add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, 180, 20));
		
		jButton5 = new javax.swing.JButton();
		
		  jButton5.setText("Log mij eens in");
		  jButton5.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent evt) {
					 jButton5ActionPerformed(evt);
				}
		  });
		  add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 180, 20));
	 }

	private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
		WinkelApplication.getInstance().showPanel(new CategoryList());
		Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
		WinkelApplication.getInstance().mainWindow.setBounds(center.x - 1280 / 2, center.y - 720 / 2, 1280, 720);
	}

	private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}
	
	private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
		System.out.println("Ingelogd: " + (UserHandler.isLoggedIn() ? "Ja" : "Nee"));
	}

	private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
		System.out.println("Login poging: Wouter/hoi");
		boolean success = UserHandler.loginAttempt("Harrie", "hoi".toCharArray());
		
		String msg = (success) ? "gelukt" : "gefaald";
		
		System.out.println("Login poging " + msg);
	}

	 // Variables declaration - do not modify
	 private javax.swing.JButton jButton1;
	 private javax.swing.JButton jButton2;
	 private javax.swing.JButton jButton3;
	private javax.swing.JButton jButton4;
	private javax.swing.JButton jButton5;
	 private javax.swing.JLabel jLabel2;
	 private javax.swing.JLabel jLabel3;
	 // End of variables declaration
}